part of 'component.dart';

class DashLine extends StatelessWidget {
  const DashLine({
    Key? key,
    this.width = 5,
    this.space = 2,
    this.color,
  }) : super(key: key);
  final double width;
  final double space;
  final Color? color;
  @override
  Widget build(BuildContext context) {
    var remain = (1.sw + space) / (width + space);
    var count = remain.truncate();
    var lastWidth = remain - count;
    var newCount = lastWidth >= 1 ? (count + 1) : count;
    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: List.generate(
          newCount,
          (index) => Container(
                height: 0.5,
                width: width,
                color: color ?? ITheme.contentColor,
              )),
    );
  }
}
